package com.gxa.saas.pojo;


import com.fasterxml.jackson.annotation.JsonIgnore;
import com.gxa.saas.mapper.VisitResultMapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class VisitCount implements Serializable {
    @JsonIgnore
    @Autowired
    VisitResultMapper visitResultMapper;
    private Integer id ;
    private String customerType;
    private String name;
    private String leaderPerson;
    private String phone;
    private Integer effectiveTime;
    private Integer  visitTime;


    public void setEffectiveTime(){
        List<VisitResult> visitResults = visitResultMapper.selectByEffective(name);
        if(visitResults==null){
            this.effectiveTime=0;
        }else{
            this.effectiveTime=visitResults.size();
        }
    }

    public void setVisitTime(){
        List<VisitResult> visitResults1 = visitResultMapper.selectByVisit(name);
        if(visitResults1==null){
            this.visitTime=0;
        }else{
            this.visitTime=visitResults1.size();
        }
    }


}
